package com.exercise.proxytest;

import com.fun.frame.SourceCode;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Method;
import java.util.Arrays;

public class CUserProxy extends SourceCode implements MethodInterceptor {

    private static Logger logger = LoggerFactory.getLogger(CUserProxy.class);

    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        logger.info("调用方法:{},参数:{}", method.getName(), Arrays.toString(args));
        proxy.invokeSuper(obj, args);
        return obj;
    }


}
